import Vue from 'vue'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import App from './App.vue'
// 导入全局样式
import './assets/css/global.css'
import router from './router'
import './assets/font/iconfont.css'

import axios from 'axios'
// 配置请求的根路径
// axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
axios.defaults.baseURL = 'http://15.15.17.86:8080/'
// axios.defaults.withCredentials = true

// 在 request 拦截器中 配置请求头
axios.interceptors.request.use(config => {
  // console.log(config.url)
  if (config.url !== 'login' && config.url !== 'register') {
    console.log(config.url)
    config.headers.token = window.sessionStorage.getItem('token')
    // config.headers.Origin = '15.15.17.56'
  }
  return config
})

// 将axios挂载到Vue的原型对象上
Vue.prototype.$http = axios

Vue.config.productionTip = false

Vue.use(MintUI)

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
